package Test;

// 实现类ComputerImpl
class ComputerImpl implements Computer {
    @Override
    public int add(int a, int b) {
        return a + b;
    }

    @Override
    public int subtract(int a, int b) {
        return a - b;
    }

    @Override
    public int multiply(int a, int b) {
        return a * b;
    }

    @Override
    public int divide(int a, int b) {
        if (b == 0) {
            throw new Ari("算数错误！");
        }
        return a / b;
    }
}

// 测试类
public class ComputerTest {
    public static void main(String[] args) {
        Computer computer = new ComputerImpl();
        System.out.println(computer.add(10, 5));
        System.out.println(computer.subtract(10, 5));
        System.out.println( computer.multiply(10, 5));
        System.out.println( computer.divide(10, 5));
    }
}
